Skip to content

Conversation

@shsms
Copy link
Collaborator

@shsms shsms commented Nov 18, 2025

No description provided.

@shsms shsms requested a review from a team as a code owner November 18, 2025 15:14
@shsms shsms marked this pull request as draft November 18, 2025 15:14
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Nov 18, 2025
Copilot finished reviewing on behalf of shsms November 18, 2025 15:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a ComponentGraphGenerator class that generates component graphs for microgrids using the Assets API. The implementation replaces template/boilerplate code with production functionality.

  • Adds ComponentGraphGenerator class for fetching and constructing microgrid component graphs from the Assets API
  • Removes template code (delete_me function) and adds real test coverage for formula generation
  • Adds git-based dependencies for frequenz-microgrid-component-graph and frequenz-client-assets

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/frequenz/gridpool/_graph_generator.py New module implementing ComponentGraphGenerator class with graph generation logic
src/frequenz/gridpool/__init__.py Exports ComponentGraphGenerator and fixes docstring typo
tests/test_gridpool.py Replaces template tests with actual test for formula generation using mocked Assets API
pyproject.toml Adds git-based dependencies and removes TODO comments
Comments suppressed due to low confidence (1)

tests/test_gridpool.py:6

  • Import of 'asyncio' is not used.
import asyncio

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@cwasicki cwasicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@shsms shsms force-pushed the implement branch 2 times, most recently from d257e1c to 9e9044c Compare December 2, 2025 10:50
@github-actions github-actions bot added the part:docs Affects the documentation label Dec 2, 2025
@shsms shsms force-pushed the implement branch 2 times, most recently from cfaf500 to 5acf430 Compare December 2, 2025 10:53
@shsms shsms marked this pull request as ready for review December 2, 2025 10:54

graph = ComponentGraph[
ElectricalComponent, ComponentConnection, ElectricalComponentId
](components, cast(list[ComponentConnection], connections))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the return type of the connection method already? Why do we need this cast?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the type is list[ComponentConnection | None] for connections. For components, it raises, for connections, it returns None. I made an issue for them: frequenz-floss/frequenz-client-assets-python#57

"""Initialize this instance.
Args:
server_url: The location of the microgrid API server in the form of a URL.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assets API server

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

sign_secret: The secret to use for signing requests.
channel_defaults: The default options used to create the channel when not
specified in the URL.
connect: Whether to connect to the server as soon as a client instance is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation for this? And how is it intended to be used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very useful for testing, when making mocks etc. But normally we'd want to connect immediately I guess.

It is a base client feature. Maybe this class should directly accept an assets service client, rather than the URL, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this class should directly accept an assets service client, rather than the URL

I think so, otherwise you need to expose all kind of settings here if you want to give the users more control over the client.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@shsms shsms force-pushed the implement branch 2 times, most recently from 8f275e1 to 579bff7 Compare December 2, 2025 14:45
@shsms shsms requested review from Copilot and cwasicki December 2, 2025 14:49
Copilot finished reviewing on behalf of shsms December 2, 2025 14:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shsms shsms enabled auto-merge December 2, 2025 14:59
@shsms shsms disabled auto-merge December 3, 2025 18:23
@shsms shsms added this pull request to the merge queue Dec 3, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 3cb48f2 Dec 3, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants